import 'package:flutter/material.dart';
import 'indexPage.dart';
import 'dart:io';
import 'package:flutter/services.dart';
void main(){
  runApp(MyApp());
  if(Platform.isAndroid){
    SystemUiOverlayStyle systemUiOverlayStyle=SystemUiOverlayStyle(statusBarIconBrightness: Brightness.dark,statusBarColor: Colors.transparent);
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }

}

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        highlightColor: Colors.white,
        splashColor: Colors.white
      ),
      home: index()
    );
  }
}
class index extends StatefulWidget{

  @override
  _indexState createState() {
    // TODO: implement createState
    return _indexState();
  }


}
class _indexState extends State<index>{
  int _selectedIndex=0;
  final _widgetOptions = [
    indexPage(),
    Text('Index 1: Home'),
    Text(''),
    Text('Index 3: School'),
    Text('Index 3: School'),

  ];
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      body:  _widgetOptions.elementAt(_selectedIndex),
      
      bottomNavigationBar: BottomNavigationBar(
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(activeIcon: Image.asset('images/homet.png',width: 20,),icon: Image.asset('images/homef.png',width: 20),title:Container(margin:EdgeInsets.only(top: 5),child:  Text("首页",style: TextStyle(fontSize: 12,color: Colors.black),),)),
            BottomNavigationBarItem(activeIcon: Image.asset('images/circlet.png',width: 20,),icon: Image.asset('images/circlef.png',width: 20),title:Container(margin:EdgeInsets.only(top: 5),child: Text("鱼塘",style: TextStyle(fontSize: 14,color: Colors.black),))),
            BottomNavigationBarItem(icon: Icon(Icons.arrow_drop_up),title: Text("发布")),
            BottomNavigationBarItem(activeIcon: Image.asset('images/messaget.png',width: 20,),icon: Image.asset('images/messagef.png',width: 20),title: Container(margin:EdgeInsets.only(top: 5),child:Text("消息",style: TextStyle(fontSize: 14,color: Colors.black),))),
            BottomNavigationBarItem(activeIcon: Image.asset('images/myt.png',width: 20,),icon: Image.asset('images/myf.png',width: 20),title: Container(margin:EdgeInsets.only(top: 5),child:Text("我的",style: TextStyle(fontSize: 14,color: Colors.black),))),
          ],
        onTap: _changeStatus,
        currentIndex: _selectedIndex,
        type: BottomNavigationBarType.fixed,


      ),//自定义bottomappbar

      floatingActionButton:FloatingActionButton(onPressed: ()=>send(),child: Image.asset('images/add.png'),elevation: 0,),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    );
  }
  //设置点击函数
_changeStatus(int i){
    if(i==2){

      send();
    }else{
      setState(() {
        _selectedIndex=i;
      });
    }

}
send(){
    print("send");
}
}



